#python jwt 时间日期
import jwt
from datetime import datetime,timedelta
from django.conf import settings

class JwtTTool:
    def get_token(self,userid):
        exp = datetime.utcnow() + timedelta(days=1)
        print(exp)
        payload = {
            'userid': userid,
            'exp': exp
        }
        key = settings.SECRET_KEY
        return "Bearer"+jwt.encode(key=key,payload=payload,algorithm='HS256')

# 拿到类得实例
tooljwt = JwtTTool()
# print(tool.get_token(1))